package cn.edu.zzu.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    /**
     * public enum IdType {
     * AUTO(0), // 数据库id自增
     * NONE(1), // 未设置主键
     * INPUT(2), // 手动输入
     * ID_WORKER(3), // 默认的全局唯一id
     * UUID(4), // 全局唯一id uuid
     * ID_WORKER_STR(5); //ID_WORKER 字符串表示法
     * }
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    private String name;
    private Integer age;
    private String email;

    /**
     * 乐观锁
     */
    @Version
    private Integer version;
    /**
     * 逻辑删除
     */
    // @TableLogic
    private Integer deleted ;

    /**
     * 插入时填充
     */
    @TableField(fill = FieldFill.INSERT)
    private Date gmtCreated;
    /**
     * 插入更新时填充
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;


    /**
     * @param id
     * @param name
     * @param age
     */
    public User(Long id, String name, Integer age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    public User(String name, Integer age, String email) {
        this.name = name;
        this.age = age;
        this.email = email;
    }


    public User(Long id, String name, Integer age, String email) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.email = email;
    }
}
